<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title>学生信息管理</title>
	</head>
	<body>
		<center>
			<?php include("menu.php"); //导入导航栏 ?>
			<h3>浏览学生信息</h3>
			<table width="700" border="1">
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>班级</th>
                    <th>操作</th>
                </tr>
                <?php
                    //实现学生信息浏览
                    //1. 导入配置文件
                    require("config.php");
                    require("Model.class.php");
                    
                    //2. 实例化Stu表信息操作对象
                    $mod = new Model("stu");
                    
                    //3. 获取所有学生信息
                    $list = $mod->select();
                   
                    //4. 遍历输出数据
                    foreach($list as $row){
                        echo "<tr>";
                        echo "<td>{$row['id']}</td>";
                        echo "<td>{$row['name']}</td>";
                        echo "<td>{$row['sex']}</td>";
                        echo "<td>{$row['age']}</td>";
                        echo "<td>{$row['classid']}</td>";
                        echo "<td>
                            <a href='action.php?a=del&id={$row['id']}'>删除</a>
                            <a href='edit.php?id={$row['id']}'>修改</a></td>";
                        echo "</tr>";
                    }
                  
                ?>
            </table>
		</center>
	</body>
</html>

